//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.aidong.dao.wills;

import com.aidong.dao.wills.BaseDao;
import com.aidong.model.wills.ReportDeposit;
import com.aidong.model.wills.ReportDepositExt;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Repository;

@Repository
public class ReportDepositDao extends BaseDao<ReportDeposit, Integer> {
    public ReportDepositDao() {
    }

    public List<ReportDepositExt> getBalanceDataAll() {
        String sql = "select a.ShopCode  \n,b.chName as ShopName \n,DATENAME(Day, a.ReportDate) AS ReportDate1 \n,a.NMUCharge \n,a.NMUTransfer \n,a.NMUBalance \n,a.PTCharge \n,a.PTTransfer \n,a.PTBalance \n,a.OtherCharge \n,a.OtherTransfer \n,a.OtherBalance \nFROM ReportDeposit a \ninner join DicShopCode b on a.ShopCode = b.code \nwhere a.ShopCode<>\'Test\' and Convert(varchar(6),a.reportdate,112) = convert(nvarchar(6),dateadd(day, -1, Getdate()),112) \norder by a.ShopCode, DATENAME(Day, a.ReportDate)   \n";
        return this.queryListBySql(ReportDepositExt.class, sql, new Object[0]);
    }

    public List<ReportDepositExt> getBalanceDataAllByDay(String serDate) {
        String sql = "select a.ShopCode  \n,b.chName as ShopName \n,DATENAME(Day, a.ReportDate) AS ReportDate1 \n,a.NMUCharge \n,a.NMUTransfer \n,a.NMUBalance \n,a.PTCharge \n,a.PTTransfer \n,a.PTBalance \n,a.OtherCharge \n,a.OtherTransfer \n,a.OtherBalance \nFROM ReportDeposit a \ninner join DicShopCode b on a.ShopCode = b.code \nwhere a.ShopCode<>\'Test\' and Convert(varchar(6),a.reportdate,112) = convert(nvarchar(6),convert(DATETIME, :p1, 121),112) \norder by a.ShopCode, DATENAME(Day, a.ReportDate)   \n";
        return this.queryListBySql(ReportDepositExt.class, sql, new Object[]{serDate});
    }

    public ReportDeposit getTbDeDataAll() {
        new ArrayList();
        String sql = "select sum(NMUCharge) as NMUCharge,sum(NMUTransfer) as NMUTransfer,sum(NMUBalance) as NMUBalance\n ,sum(PTCharge) as PTCharge ,sum(PTTransfer) as PTTransfer,sum(PTBalance) as PTBalance  \n ,sum(OtherCharge) as OtherCharge ,sum(OtherTransfer) as OtherTransfer,sum(OtherBalance) as OtherBalance \n from ReportDeposit a \n where ShopCode<>\'Test\' and Convert(varchar(10),a.reportdate,111) = Convert(varchar(10),dateadd(day, -1, Getdate()),111) \n group by Convert(varchar(10),a.ReportDate,111) \n";
        List lst = this.queryListBySql(ReportDeposit.class, sql, new Object[0]);
        return lst != null && lst.size() > 0?(ReportDeposit)lst.get(0):new ReportDeposit();
    }

    public ReportDeposit getTbDeDataAllByDay(String serDate) {
        new ArrayList();
        String sql = "select sum(NMUCharge) as NMUCharge,sum(NMUTransfer) as NMUTransfer,sum(NMUBalance) as NMUBalance\n ,sum(PTCharge) as PTCharge ,sum(PTTransfer) as PTTransfer,sum(PTBalance) as PTBalance  \n ,sum(OtherCharge) as OtherCharge ,sum(OtherTransfer) as OtherTransfer,sum(OtherBalance) as OtherBalance \n from ReportDeposit a \n where ShopCode<>\'Test\' and Convert(varchar(10),a.reportdate,111) = Convert(varchar(10),convert(DATETIME, :p1, 121),111) \n group by Convert(varchar(10),a.ReportDate,111) \n";
        List lst = this.queryListBySql(ReportDeposit.class, sql, new Object[]{serDate});
        return lst != null && lst.size() > 0?(ReportDeposit)lst.get(0):new ReportDeposit();
    }

    public ReportDeposit getTbDeDataByShopCode(String shopCode) {
        new ArrayList();
        String sql = "select NMUCharge,NMUTransfer,NMUBalance\n ,PTCharge,PTTransfer,PTBalance  \n ,OtherCharge,OtherTransfer,OtherBalance \n from ReportDeposit a \n where Convert(varchar(10),a.reportdate,111) = Convert(varchar(10),dateadd(day, -1, Getdate()),111) \n and a.ShopCode = :p1 \n";
        List lst = this.queryListBySql(ReportDeposit.class, sql, new Object[]{shopCode});
        return lst != null && lst.size() > 0?(ReportDeposit)lst.get(0):new ReportDeposit();
    }

    public ReportDeposit getTbDeDataByShopCodeAndDay(String shopCode, String serDate) {
        new ArrayList();
        String sql = "select NMUCharge,NMUTransfer,NMUBalance\n ,PTCharge,PTTransfer,PTBalance  \n ,OtherCharge,OtherTransfer,OtherBalance \n from ReportDeposit a \n where Convert(varchar(10),a.reportdate,111) = Convert(varchar(10),convert(DATETIME, :p2, 121),111) \n and a.ShopCode = :p1 \n";
        List lst = this.queryListBySql(ReportDeposit.class, sql, new Object[]{shopCode, serDate});
        return lst != null && lst.size() > 0?(ReportDeposit)lst.get(0):new ReportDeposit();
    }
}
